<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 不跳转页面实现 -->
    <a href="javascript:;">href="javascript:;</a>
    <a href="#ccc">#ccc锚点</a>
    <a href="#about">#about锚点</a>
    <div style="height:3000px;background-color: skyblue;">
        <a href="https://www.cnblogs.com/douyaer/p/7632621.html">《JS获取网页高度和宽度》索引</a>
    </div>
    <a href="" name="ccc" style="background-color:blueviolet">ccc跳转到这</a>
    <div style="height:3000px;background-color: blue;">
        <a href="https://www.cnblogs.com/douyaer/p/7632621.html">《JS获取网页高度和宽度》索引</a>
    </div>
    <a href="" name="about" style="background-color:pink">about跳转到这</a>
    <script>
        window.onhashchange = function (event) {
            console.log(event)
        }
    </script>
</body>

</html>